{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import bokeh.models"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Bokeh绘制基本图形"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1001\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  var JS_MIME_TYPE = 'application/javascript';\n",
       "  var HTML_MIME_TYPE = 'text/html';\n",
       "  var EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  var CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    var script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    var cell = handle.cell;\n",
       "\n",
       "    var id = cell.output_area._bokeh_element_id;\n",
       "    var server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      var cmd = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            var id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      var cmd = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    var output_area = handle.output_area;\n",
       "    var output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      var bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      var script_attrs = bk_div.children[0].attributes;\n",
       "      for (var i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      var toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    var events = require('base/js/events');\n",
       "    var OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    var el = document.getElementById(\"1001\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error() {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (var i = 0; i < css_urls.length; i++) {\n",
       "      var url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n",
       "\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error;\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      if (url in hashes) {\n",
       "        element.crossOrigin = \"anonymous\";\n",
       "        element.integrity = \"sha384-\" + hashes[url];\n",
       "      }\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n",
       "  var css_urls = [];\n",
       "  \n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (var i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  var force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  var NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    var el = document.getElementById(\"1001\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error() {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (var i = 0; i < css_urls.length; i++) {\n      var url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    const hashes = {\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\": \"kLr4fYcqcSpbuI95brIH3vnnYCquzzSxHPU6XGQCIkQRGJwhg0StNbj1eegrHs12\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\": \"xIGPmVtaOm+z0BqfSOMn4lOR6ciex448GIKG4eE61LsAvmGj48XcMQZtKcE/UXZe\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\": \"Dc9u1wF/0zApGIWoBbH77iWEHtdmkuYWG839Uzmv8y8yBLXebjO9ZnERsde5Ln/P\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\": \"cT9JaBz7GiRXdENrJLZNSC6eMNF3nh3fa5fTF51Svp+ukxPdwcU5kGXGPBgDCa2j\"};\n\n    for (var i = 0; i < js_urls.length; i++) {\n      var url = js_urls[i];\n      var element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error;\n      element.async = false;\n      element.src = url;\n      if (url in hashes) {\n        element.crossOrigin = \"anonymous\";\n        element.integrity = \"sha384-\" + hashes[url];\n      }\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  var js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.1.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.1.1.min.js\"];\n  var css_urls = [];\n  \n\n  var inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (var i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      var cell = $(document.getElementById(\"1001\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "from bokeh.plotting import figure,show,output_notebook\n",
    "from bokeh.layouts import gridplot\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "N=9 #九个值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.linspace(-2,2,N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = x**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "sizes = np.linspace(10,20,N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([10.  , 11.25, 12.5 , 13.75, 15.  , 16.25, 17.5 , 18.75, 20.  ])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sizes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "xpts = np.array([-.09,-.12,.0,.12,.09])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "figures = [] #图形列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "p = figure(title=\"circle\")\n",
    "p.circle(x,y,radius=0.2,color=\"#911005\")\n",
    "#show(p)——单个展示\n",
    "figures.append(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "p = figure(title=\"triangle\")\n",
    "p.scatter(x,y,marker=\"triangle\",size=sizes,color=\"#911005\",line_width=2)\n",
    "#show(p)\n",
    "figures.append(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"2d5f6f36-6e6c-47c7-b157-5fc8cd71348a\" data-root-id=\"1099\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"0f3466d4-3c6f-4390-a473-12de8351fdb5\":{\"roots\":{\"references\":[{\"attributes\":{\"children\":[{\"id\":\"1098\"},{\"id\":\"1096\"}]},\"id\":\"1099\",\"type\":\"Column\"},{\"attributes\":{\"axis\":{\"id\":\"1013\"},\"ticker\":null},\"id\":\"1016\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1022\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1081\"},\"ticker\":{\"id\":\"1018\"}},\"id\":\"1017\",\"type\":\"LinearAxis\"},{\"attributes\":{\"formatter\":{\"id\":\"1090\"},\"ticker\":{\"id\":\"1056\"}},\"id\":\"1055\",\"type\":\"LinearAxis\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1065\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"below\":[{\"id\":\"1013\"}],\"center\":[{\"id\":\"1016\"},{\"id\":\"1020\"}],\"left\":[{\"id\":\"1017\"}],\"plot_height\":200,\"plot_width\":200,\"renderers\":[{\"id\":\"1038\"}],\"title\":{\"id\":\"1003\"},\"toolbar\":{\"id\":\"1028\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1005\"},\"x_scale\":{\"id\":\"1009\"},\"y_range\":{\"id\":\"1007\"},\"y_scale\":{\"id\":\"1011\"}},\"id\":\"1002\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1079\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"below\":[{\"id\":\"1051\"}],\"center\":[{\"id\":\"1054\"},{\"id\":\"1058\"}],\"left\":[{\"id\":\"1055\"}],\"plot_height\":200,\"plot_width\":200,\"renderers\":[{\"id\":\"1076\"}],\"title\":{\"id\":\"1041\"},\"toolbar\":{\"id\":\"1066\"},\"toolbar_location\":null,\"x_range\":{\"id\":\"1043\"},\"x_scale\":{\"id\":\"1047\"},\"y_range\":{\"id\":\"1045\"},\"y_scale\":{\"id\":\"1049\"}},\"id\":\"1040\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"fill_color\":{\"value\":\"#911005\"},\"line_color\":{\"value\":\"#911005\"},\"line_width\":{\"value\":2},\"marker\":{\"value\":\"triangle\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1074\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1026\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1083\",\"type\":\"Selection\"},{\"attributes\":{\"formatter\":{\"id\":\"1088\"},\"ticker\":{\"id\":\"1052\"}},\"id\":\"1051\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1088\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1007\",\"type\":\"DataRange1d\"},{\"attributes\":{\"axis\":{\"id\":\"1055\"},\"dimension\":1,\"ticker\":null},\"id\":\"1058\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"1073\"},\"glyph\":{\"id\":\"1074\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1075\"},\"selection_glyph\":null,\"view\":{\"id\":\"1077\"}},\"id\":\"1076\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"text\":\"circle\"},\"id\":\"1003\",\"type\":\"Title\"},{\"attributes\":{\"text\":\"triangle\"},\"id\":\"1041\",\"type\":\"Title\"},{\"attributes\":{\"source\":{\"id\":\"1073\"}},\"id\":\"1077\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1043\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1018\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1005\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1064\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1059\",\"type\":\"PanTool\"},{\"attributes\":{\"axis\":{\"id\":\"1017\"},\"dimension\":1,\"ticker\":null},\"id\":\"1020\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1011\",\"type\":\"LinearScale\"},{\"attributes\":{\"data\":{\"x\":{\"__ndarray__\":\"AAAAAAAAAMAAAAAAAAD4vwAAAAAAAPC/AAAAAAAA4L8AAAAAAAAAAAAAAAAAAOA/AAAAAAAA8D8AAAAAAAD4PwAAAAAAAABA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]},\"y\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAAACQAAAAAAAAPA/AAAAAAAA0D8AAAAAAAAAAAAAAAAAANA/AAAAAAAA8D8AAAAAAAACQAAAAAAAABBA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]}},\"selected\":{\"id\":\"1083\"},\"selection_policy\":{\"id\":\"1084\"}},\"id\":\"1035\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1014\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1027\"}},\"id\":\"1023\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#911005\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#911005\"},\"line_width\":{\"value\":2},\"marker\":{\"value\":\"triangle\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1075\",\"type\":\"Scatter\"},{\"attributes\":{\"children\":[[{\"id\":\"1002\"},0,0],[{\"id\":\"1040\"},0,1]]},\"id\":\"1096\",\"type\":\"GridBox\"},{\"attributes\":{\"formatter\":{\"id\":\"1079\"},\"ticker\":{\"id\":\"1014\"}},\"id\":\"1013\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1035\"}},\"id\":\"1039\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1009\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"SaveTool\"},{\"attributes\":{\"toolbars\":[{\"id\":\"1028\"},{\"id\":\"1066\"}],\"tools\":[{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"},{\"id\":\"1026\"},{\"id\":\"1059\"},{\"id\":\"1060\"},{\"id\":\"1061\"},{\"id\":\"1062\"},{\"id\":\"1063\"},{\"id\":\"1064\"}]},\"id\":\"1097\",\"type\":\"ProxyToolbar\"},{\"attributes\":{},\"id\":\"1062\",\"type\":\"SaveTool\"},{\"attributes\":{\"toolbar\":{\"id\":\"1097\"},\"toolbar_location\":\"above\"},\"id\":\"1098\",\"type\":\"ToolbarBox\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1059\"},{\"id\":\"1060\"},{\"id\":\"1061\"},{\"id\":\"1062\"},{\"id\":\"1063\"},{\"id\":\"1064\"}]},\"id\":\"1066\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"1051\"},\"ticker\":null},\"id\":\"1054\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#911005\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#911005\"},\"radius\":{\"units\":\"data\",\"value\":0.2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1037\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1049\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_color\":{\"value\":\"#911005\"},\"line_color\":{\"value\":\"#911005\"},\"radius\":{\"units\":\"data\",\"value\":0.2},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1036\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1052\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1090\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1084\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1027\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1093\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1056\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data\":{\"size\":{\"__ndarray__\":\"AAAAAAAAJEAAAAAAAIAmQAAAAAAAAClAAAAAAACAK0AAAAAAAAAuQAAAAAAAQDBAAAAAAACAMUAAAAAAAMAyQAAAAAAAADRA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]},\"x\":{\"__ndarray__\":\"AAAAAAAAAMAAAAAAAAD4vwAAAAAAAPC/AAAAAAAA4L8AAAAAAAAAAAAAAAAAAOA/AAAAAAAA8D8AAAAAAAD4PwAAAAAAAABA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]},\"y\":{\"__ndarray__\":\"AAAAAAAAEEAAAAAAAAACQAAAAAAAAPA/AAAAAAAA0D8AAAAAAAAAAAAAAAAAANA/AAAAAAAA8D8AAAAAAAACQAAAAAAAABBA\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[9]}},\"selected\":{\"id\":\"1092\"},\"selection_policy\":{\"id\":\"1093\"}},\"id\":\"1073\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"1065\"}},\"id\":\"1061\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"1035\"},\"glyph\":{\"id\":\"1036\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1037\"},\"selection_glyph\":null,\"view\":{\"id\":\"1039\"}},\"id\":\"1038\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1081\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1092\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1063\",\"type\":\"ResetTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"},{\"id\":\"1026\"}]},\"id\":\"1028\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1060\",\"type\":\"WheelZoomTool\"}],\"root_ids\":[\"1099\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"0f3466d4-3c6f-4390-a473-12de8351fdb5\",\"root_ids\":[\"1099\"],\"roots\":{\"1099\":\"2d5f6f36-6e6c-47c7-b157-5fc8cd71348a\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1099"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(gridplot(figures,ncols=2,plot_width=200,plot_height=200))\n",
    "# 列表展示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 散点图\n",
    "\n",
    "* 属性参数：\n",
    "> 1. x:x坐标\n",
    "> 1. y:y坐标\n",
    "> 1. size:离散点点大小\n",
    "> 1. marker:离散点点标记名称\n",
    "> 1. color:填充及轮廓线颜色\n",
    "> 1. alpha:透明度\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"8dc7fd3e-c0ca-4b06-9338-6980be7ed22f\" data-root-id=\"1212\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"b78fb0bd-3e65-4643-9528-8deaa7937495\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1223\"}],\"center\":[{\"id\":\"1226\"},{\"id\":\"1230\"}],\"left\":[{\"id\":\"1227\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"1248\"}],\"title\":{\"id\":\"1213\"},\"toolbar\":{\"id\":\"1238\"},\"x_range\":{\"id\":\"1215\"},\"x_scale\":{\"id\":\"1219\"},\"y_range\":{\"id\":\"1217\"},\"y_scale\":{\"id\":\"1221\"}},\"id\":\"1212\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1234\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"#911005\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"#911005\"},\"size\":{\"units\":\"screen\",\"value\":20},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1246\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1215\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1224\",\"type\":\"BasicTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"1267\"},\"ticker\":{\"id\":\"1224\"}},\"id\":\"1223\",\"type\":\"LinearAxis\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1237\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1272\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1217\",\"type\":\"DataRange1d\"},{\"attributes\":{\"source\":{\"id\":\"1245\"}},\"id\":\"1249\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1219\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1267\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1269\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"overlay\":{\"id\":\"1237\"}},\"id\":\"1233\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1232\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1235\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1231\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1228\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"1245\"},\"glyph\":{\"id\":\"1246\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1247\"},\"selection_glyph\":null,\"view\":{\"id\":\"1249\"}},\"id\":\"1248\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1236\",\"type\":\"HelpTool\"},{\"attributes\":{\"axis\":{\"id\":\"1227\"},\"dimension\":1,\"ticker\":null},\"id\":\"1230\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]},\"selected\":{\"id\":\"1271\"},\"selection_policy\":{\"id\":\"1272\"}},\"id\":\"1245\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"formatter\":{\"id\":\"1269\"},\"ticker\":{\"id\":\"1228\"}},\"id\":\"1227\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1221\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1271\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"1223\"},\"ticker\":null},\"id\":\"1226\",\"type\":\"Grid\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1231\"},{\"id\":\"1232\"},{\"id\":\"1233\"},{\"id\":\"1234\"},{\"id\":\"1235\"},{\"id\":\"1236\"}]},\"id\":\"1238\",\"type\":\"Toolbar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#911005\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#911005\"},\"size\":{\"units\":\"screen\",\"value\":20},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1247\",\"type\":\"Scatter\"},{\"attributes\":{\"text\":\"\\u6563\\u70b9\\u56fe\\u793a\\u4f8b\"},\"id\":\"1213\",\"type\":\"Title\"}],\"root_ids\":[\"1212\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"b78fb0bd-3e65-4643-9528-8deaa7937495\",\"root_ids\":[\"1212\"],\"roots\":{\"1212\":\"8dc7fd3e-c0ca-4b06-9338-6980be7ed22f\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1212"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = [1,2,3,4,5]\n",
    "y = [6,7,2,4,5]\n",
    "\n",
    "p=figure(title=\"散点图示例\",plot_width=400,plot_height=400)\n",
    "\n",
    "p.scatter(x,y,\n",
    "        size=20,\n",
    "        marker=\"circle\",color=\"#911005\",alpha=0.5)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"8fc1a1f2-7e08-4b62-8c9a-fc55059432b6\" data-root-id=\"1322\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"48559bef-e096-402a-853e-3ebcffe4ca36\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1333\"}],\"center\":[{\"id\":\"1336\"},{\"id\":\"1340\"}],\"left\":[{\"id\":\"1337\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"1358\"}],\"title\":{\"id\":\"1323\"},\"toolbar\":{\"id\":\"1348\"},\"x_range\":{\"id\":\"1325\"},\"x_scale\":{\"id\":\"1329\"},\"y_range\":{\"id\":\"1327\"},\"y_scale\":{\"id\":\"1331\"}},\"id\":\"1322\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1390\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"navy\"},\"size\":{\"units\":\"screen\",\"value\":50},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1356\",\"type\":\"Circle\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"navy\"},\"size\":{\"units\":\"screen\",\"value\":50},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1357\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1346\",\"type\":\"HelpTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1387\"},\"ticker\":{\"id\":\"1338\"}},\"id\":\"1337\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]},\"selected\":{\"id\":\"1389\"},\"selection_policy\":{\"id\":\"1390\"}},\"id\":\"1355\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"1355\"}},\"id\":\"1359\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1338\",\"type\":\"BasicTicker\"},{\"attributes\":{\"text\":\"\\u6563\\u70b9\\u56fe\\u793a\\u4f8b\"},\"id\":\"1323\",\"type\":\"Title\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1341\"},{\"id\":\"1342\"},{\"id\":\"1343\"},{\"id\":\"1344\"},{\"id\":\"1345\"},{\"id\":\"1346\"}]},\"id\":\"1348\",\"type\":\"Toolbar\"},{\"attributes\":{\"axis\":{\"id\":\"1337\"},\"dimension\":1,\"ticker\":null},\"id\":\"1340\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1387\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1325\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1389\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1334\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1341\",\"type\":\"PanTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1347\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"formatter\":{\"id\":\"1385\"},\"ticker\":{\"id\":\"1334\"}},\"id\":\"1333\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1331\",\"type\":\"LinearScale\"},{\"attributes\":{\"data_source\":{\"id\":\"1355\"},\"glyph\":{\"id\":\"1356\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1357\"},\"selection_glyph\":null,\"view\":{\"id\":\"1359\"}},\"id\":\"1358\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1342\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1327\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1329\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"1333\"},\"ticker\":null},\"id\":\"1336\",\"type\":\"Grid\"},{\"attributes\":{\"overlay\":{\"id\":\"1347\"}},\"id\":\"1343\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1345\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1344\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1385\",\"type\":\"BasicTickFormatter\"}],\"root_ids\":[\"1322\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"48559bef-e096-402a-853e-3ebcffe4ca36\",\"root_ids\":[\"1322\"],\"roots\":{\"1322\":\"8fc1a1f2-7e08-4b62-8c9a-fc55059432b6\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1322"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = [1,2,3,4,5]\n",
    "y = [6,7,2,4,5]\n",
    "\n",
    "p=figure(title=\"散点图示例\",plot_width=400,plot_height=400)\n",
    "\n",
    "p.circle(x, y, size=50, color=\"navy\", alpha=0.5)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on GlyphRenderer in module bokeh.models.renderers object:\n",
      "\n",
      "class GlyphRenderer(DataRenderer)\n",
      " |  GlyphRenderer(*args, **kwargs)\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      GlyphRenderer\n",
      " |      DataRenderer\n",
      " |      Renderer\n",
      " |      bokeh.model.Model\n",
      " |      bokeh.core.has_props.HasProps\n",
      " |      bokeh.util.callback_manager.PropertyCallbackManager\n",
      " |      bokeh.util.callback_manager.EventCallbackManager\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __init__(self, **kw)\n",
      " |  \n",
      " |  __str__(self)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  data_source\n",
      " |      Local data source to use when rendering glyphs on the plot.\n",
      " |  \n",
      " |  glyph\n",
      " |      The glyph to render, in conjunction with the supplied data source\n",
      " |      and ranges.\n",
      " |  \n",
      " |  hover_glyph\n",
      " |      An optional glyph used for inspected points, e.g., those that are\n",
      " |      being hovered over by a ``HoverTool``.\n",
      " |  \n",
      " |  muted\n",
      " |  \n",
      " |  muted_glyph\n",
      " |  \n",
      " |  nonselection_glyph\n",
      " |      An optional glyph used for explicitly non-selected points\n",
      " |      (i.e., non-selected when there are other points that are selected,\n",
      " |      but not when no points at all are selected.)\n",
      " |      \n",
      " |      If set to \"auto\" then a glyph with a low alpha value (0.1) will\n",
      " |      be used for non-selected points.\n",
      " |  \n",
      " |  selection_glyph\n",
      " |      An optional glyph used for selected points.\n",
      " |      \n",
      " |      If set to \"auto\" then the standard glyph will be used for selected\n",
      " |      points.\n",
      " |  \n",
      " |  view\n",
      " |      A view into the data source to use when rendering glyphs. A default view\n",
      " |      of the entire data source is created when a view is not passed in during\n",
      " |      initialization.\n",
      " |      \n",
      " |      .. note:\n",
      " |          Only the default (filterless) CDSView is compatible with glyphs that\n",
      " |          have connected topology, such as Line and Patch. Setting filters on\n",
      " |          views for these glyphs will result in a warning and undefined behavior.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  __cached_all__overridden_defaults__ = {'level': 'glyph'}\n",
      " |  \n",
      " |  __cached_all__properties__ = {'data_source', 'glyph', 'hover_glyph', '...\n",
      " |  \n",
      " |  __cached_all__properties_with_refs__ = {'data_source', 'glyph', 'hover...\n",
      " |  \n",
      " |  __container_props__ = set()\n",
      " |  \n",
      " |  __properties__ = {'data_source', 'glyph', 'hover_glyph', 'muted', 'mut...\n",
      " |  \n",
      " |  __properties_with_refs__ = {'data_source', 'glyph', 'hover_glyph', 'mu...\n",
      " |  \n",
      " |  __qualified_model__ = 'GlyphRenderer'\n",
      " |  \n",
      " |  __view_model__ = 'GlyphRenderer'\n",
      " |  \n",
      " |  __view_module__ = 'bokeh.models.renderers'\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from DataRenderer:\n",
      " |  \n",
      " |  x_range_name\n",
      " |      A particular (named) x-range to use for computing screen locations when\n",
      " |      rendering glyphs on the plot. If unset, use the default x-range.\n",
      " |  \n",
      " |  y_range_name\n",
      " |      A particular (named) y-range to use for computing screen locations when\n",
      " |      rendering glyphs on the plot. If unset, use the default y-range.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from DataRenderer:\n",
      " |  \n",
      " |  __overridden_defaults__ = {'level': 'glyph'}\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from Renderer:\n",
      " |  \n",
      " |  level\n",
      " |      Specifies the level in which to paint this renderer.\n",
      " |  \n",
      " |  visible\n",
      " |      Is the renderer visible.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from bokeh.model.Model:\n",
      " |  \n",
      " |  __repr__ = __str__(self)\n",
      " |      Return str(self).\n",
      " |  \n",
      " |  js_link(self, attr, other, other_attr, attr_selector=None)\n",
      " |      Link two Bokeh model properties using JavaScript.\n",
      " |      \n",
      " |      This is a convenience method that simplifies adding a CustomJS callback\n",
      " |      to update one Bokeh model property whenever another changes value.\n",
      " |      \n",
      " |      Args:\n",
      " |      \n",
      " |          attr (str) :\n",
      " |              The name of a Bokeh property on this model\n",
      " |      \n",
      " |          other (Model):\n",
      " |              A Bokeh model to link to self.attr\n",
      " |      \n",
      " |          other_attr (str) :\n",
      " |              The property on ``other`` to link together\n",
      " |      \n",
      " |          attr_selector (Union[int, str]) :\n",
      " |              The index to link an item in a subscriptable ``attr``\n",
      " |      \n",
      " |      Added in version 1.1\n",
      " |      \n",
      " |      Raises:\n",
      " |      \n",
      " |          ValueError\n",
      " |      \n",
      " |      Examples:\n",
      " |      \n",
      " |          This code with ``js_link``:\n",
      " |      \n",
      " |          .. code :: python\n",
      " |      \n",
      " |              select.js_link('value', plot, 'sizing_mode')\n",
      " |      \n",
      " |          is equivalent to the following:\n",
      " |      \n",
      " |          .. code:: python\n",
      " |      \n",
      " |              from bokeh.models import CustomJS\n",
      " |              select.js_on_change('value',\n",
      " |                  CustomJS(args=dict(other=plot),\n",
      " |                           code=\"other.sizing_mode = this.value\"\n",
      " |                  )\n",
      " |              )\n",
      " |      \n",
      " |          Additionally, to use attr_selector to attach the left side of a range slider to a plot's x_range:\n",
      " |      \n",
      " |          .. code :: python\n",
      " |      \n",
      " |              range_slider.js_link('value', plot.x_range, 'start', attr_selector=0)\n",
      " |      \n",
      " |          which is equivalent to:\n",
      " |      \n",
      " |          .. code :: python\n",
      " |      \n",
      " |              from bokeh.models import CustomJS\n",
      " |              range_slider.js_on_change('value',\n",
      " |                  CustomJS(args=dict(other=plot.x_range),\n",
      " |                           code=\"other.start = this.value[0]\"\n",
      " |                  )\n",
      " |              )\n",
      " |  \n",
      " |  js_on_change(self, event, *callbacks)\n",
      " |      Attach a ``CustomJS`` callback to an arbitrary BokehJS model event.\n",
      " |      \n",
      " |      On the BokehJS side, change events for model properties have the\n",
      " |      form ``\"change:property_name\"``. As a convenience, if the event name\n",
      " |      passed to this method is also the name of a property on the model,\n",
      " |      then it will be prefixed with ``\"change:\"`` automatically:\n",
      " |      \n",
      " |      .. code:: python\n",
      " |      \n",
      " |          # these two are equivalent\n",
      " |          source.js_on_change('data', callback)\n",
      " |          source.js_on_change('change:data', callback)\n",
      " |      \n",
      " |      However, there are other kinds of events that can be useful to respond\n",
      " |      to, in addition to property change events. For example to run a\n",
      " |      callback whenever data is streamed to a ``ColumnDataSource``, use the\n",
      " |      ``\"stream\"`` event on the source:\n",
      " |      \n",
      " |      .. code:: python\n",
      " |      \n",
      " |          source.js_on_change('streaming', callback)\n",
      " |  \n",
      " |  js_on_event(self, event, *callbacks)\n",
      " |  \n",
      " |  layout(self, side, plot)\n",
      " |  \n",
      " |  on_change(self, attr, *callbacks)\n",
      " |      Add a callback on this object to trigger when ``attr`` changes.\n",
      " |      \n",
      " |      Args:\n",
      " |          attr (str) : an attribute name on this object\n",
      " |          *callbacks (callable) : callback functions to register\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |      \n",
      " |      Example:\n",
      " |      \n",
      " |      .. code-block:: python\n",
      " |      \n",
      " |          widget.on_change('value', callback1, callback2, ..., callback_n)\n",
      " |  \n",
      " |  references(self)\n",
      " |      Returns all ``Models`` that this object has references to.\n",
      " |  \n",
      " |  select(self, selector)\n",
      " |      Query this object and all of its references for objects that\n",
      " |      match the given selector.\n",
      " |      \n",
      " |      Args:\n",
      " |          selector (JSON-like) :\n",
      " |      \n",
      " |      Returns:\n",
      " |          seq[Model]\n",
      " |  \n",
      " |  select_one(self, selector)\n",
      " |      Query this object and all of its references for objects that\n",
      " |      match the given selector.  Raises an error if more than one object\n",
      " |      is found.  Returns single matching object, or None if nothing is found\n",
      " |      Args:\n",
      " |          selector (JSON-like) :\n",
      " |      \n",
      " |      Returns:\n",
      " |          Model\n",
      " |  \n",
      " |  set_select(self, selector, updates)\n",
      " |      Update objects that match a given selector with the specified\n",
      " |      attribute/value updates.\n",
      " |      \n",
      " |      Args:\n",
      " |          selector (JSON-like) :\n",
      " |          updates (dict) :\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |  \n",
      " |  to_json(self, include_defaults)\n",
      " |      Returns a dictionary of the attributes of this object,\n",
      " |      containing only \"JSON types\" (string, number, boolean,\n",
      " |      none, dict, list).\n",
      " |      \n",
      " |      References to other objects are serialized as \"refs\" (just\n",
      " |      the object ID and type info), so the deserializer will\n",
      " |      need to separately have the full attributes of those\n",
      " |      other objects.\n",
      " |      \n",
      " |      There's no corresponding ``from_json()`` because to\n",
      " |      deserialize an object is normally done in the context of a\n",
      " |      Document (since the Document can resolve references).\n",
      " |      \n",
      " |      For most purposes it's best to serialize and deserialize\n",
      " |      entire documents.\n",
      " |      \n",
      " |      Args:\n",
      " |          include_defaults (bool) : whether to include attributes\n",
      " |              that haven't been changed from the default\n",
      " |  \n",
      " |  to_json_string(self, include_defaults)\n",
      " |      Returns a JSON string encoding the attributes of this object.\n",
      " |      \n",
      " |      References to other objects are serialized as references\n",
      " |      (just the object ID and type info), so the deserializer\n",
      " |      will need to separately have the full attributes of those\n",
      " |      other objects.\n",
      " |      \n",
      " |      There's no corresponding ``from_json_string()`` because to\n",
      " |      deserialize an object is normally done in the context of a\n",
      " |      Document (since the Document can resolve references).\n",
      " |      \n",
      " |      For most purposes it's best to serialize and deserialize\n",
      " |      entire documents.\n",
      " |      \n",
      " |      Args:\n",
      " |          include_defaults (bool) : whether to include attributes\n",
      " |              that haven't been changed from the default\n",
      " |  \n",
      " |  trigger(self, attr, old, new, hint=None, setter=None)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from bokeh.model.Model:\n",
      " |  \n",
      " |  __init_subclass__() from bokeh.core.has_props.MetaHasProps\n",
      " |      This method is called when a class is subclassed.\n",
      " |      \n",
      " |      The default implementation does nothing. It may be\n",
      " |      overridden to extend subclasses.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods inherited from bokeh.model.Model:\n",
      " |  \n",
      " |  __new__(cls, *args, **kwargs)\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from bokeh.model.Model:\n",
      " |  \n",
      " |  document\n",
      " |      The |Document| this model is attached to (can be ``None``)\n",
      " |  \n",
      " |  id\n",
      " |  \n",
      " |  ref\n",
      " |  \n",
      " |  struct\n",
      " |      A Bokeh protocol \"structure\" of this model, i.e. a dict of the form:\n",
      " |      \n",
      " |      .. code-block:: python\n",
      " |      \n",
      " |          {\n",
      " |              'type' : << view model name >>\n",
      " |              'id'   : << unique model id >>\n",
      " |          }\n",
      " |      \n",
      " |      Additionally there may be a `subtype` field if this model is a subtype.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from bokeh.model.Model:\n",
      " |  \n",
      " |  js_event_callbacks\n",
      " |      A mapping of event names to lists of ``CustomJS`` callbacks.\n",
      " |      \n",
      " |      Typically, rather then modifying this property directly, callbacks should be\n",
      " |      added using the ``Model.js_on_event`` method:\n",
      " |      \n",
      " |      .. code:: python\n",
      " |      \n",
      " |          callback = CustomJS(code=\"console.log('tap event occurred')\")\n",
      " |          plot.js_on_event('tap', callback)\n",
      " |  \n",
      " |  js_property_callbacks\n",
      " |      A mapping of attribute names to lists of ``CustomJS`` callbacks, to be set up on\n",
      " |      BokehJS side when the document is created.\n",
      " |      \n",
      " |      Typically, rather then modifying this property directly, callbacks should be\n",
      " |      added using the ``Model.js_on_change`` method:\n",
      " |      \n",
      " |      .. code:: python\n",
      " |      \n",
      " |          callback = CustomJS(code=\"console.log('stuff')\")\n",
      " |          plot.x_range.js_on_change('start', callback)\n",
      " |  \n",
      " |  name\n",
      " |      An arbitrary, user-supplied name for this model.\n",
      " |      \n",
      " |      This name can be useful when querying the document to retrieve specific\n",
      " |      Bokeh models.\n",
      " |      \n",
      " |      .. code:: python\n",
      " |      \n",
      " |          >>> plot.circle([1,2,3], [4,5,6], name=\"temp\")\n",
      " |          >>> plot.select(name=\"temp\")\n",
      " |          [GlyphRenderer(id='399d53f5-73e9-44d9-9527-544b761c7705', ...)]\n",
      " |      \n",
      " |      .. note::\n",
      " |          No uniqueness guarantees or other conditions are enforced on any names\n",
      " |          that are provided, nor is the name used directly by Bokeh for any\n",
      " |          reason.\n",
      " |  \n",
      " |  subscribed_events\n",
      " |      List of events that are subscribed to by Python callbacks. This is\n",
      " |      the set of events that will be communicated from BokehJS back to\n",
      " |      Python for this model.\n",
      " |  \n",
      " |  tags\n",
      " |      An optional list of arbitrary, user-supplied values to attach to this\n",
      " |      model.\n",
      " |      \n",
      " |      This data can be useful when querying the document to retrieve specific\n",
      " |      Bokeh models:\n",
      " |      \n",
      " |      .. code:: python\n",
      " |      \n",
      " |          >>> r = plot.circle([1,2,3], [4,5,6])\n",
      " |          >>> r.tags = [\"foo\", 10]\n",
      " |          >>> plot.select(tags=['foo', 10])\n",
      " |          [GlyphRenderer(id='1de4c3df-a83d-480a-899b-fb263d3d5dd9', ...)]\n",
      " |      \n",
      " |      Or simply a convenient way to attach any necessary metadata to a model\n",
      " |      that can be accessed by ``CustomJS`` callbacks, etc.\n",
      " |      \n",
      " |      .. note::\n",
      " |          No uniqueness guarantees or other conditions are enforced on any tags\n",
      " |          that are provided, nor are the tags used directly by Bokeh for any\n",
      " |          reason.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from bokeh.model.Model:\n",
      " |  \n",
      " |  model_class_reverse_map = {'AbstractButton': <class 'bokeh.models.widg...\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from bokeh.core.has_props.HasProps:\n",
      " |  \n",
      " |  __setattr__(self, name, value)\n",
      " |      Intercept attribute setting on HasProps in order to special case\n",
      " |      a few situations:\n",
      " |      \n",
      " |      * short circuit all property machinery for ``_private`` attributes\n",
      " |      * suggest similar attribute names on attribute errors\n",
      " |      \n",
      " |      Args:\n",
      " |          name (str) : the name of the attribute to set on this object\n",
      " |          value (obj) : the value to set\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |  \n",
      " |  apply_theme(self, property_values)\n",
      " |      Apply a set of theme values which will be used rather than\n",
      " |      defaults, but will not override application-set values.\n",
      " |      \n",
      " |      The passed-in dictionary may be kept around as-is and shared with\n",
      " |      other instances to save memory (so neither the caller nor the\n",
      " |      |HasProps| instance should modify it).\n",
      " |      \n",
      " |      Args:\n",
      " |          property_values (dict) : theme values to use in place of defaults\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |  \n",
      " |  equals(self, other)\n",
      " |      Structural equality of models.\n",
      " |      \n",
      " |      Args:\n",
      " |          other (HasProps) : the other instance to compare to\n",
      " |      \n",
      " |      Returns:\n",
      " |          True, if properties are structurally equal, otherwise False\n",
      " |  \n",
      " |  properties_with_values(self, include_defaults: bool = True) -> Dict[str, Any]\n",
      " |      Collect a dict mapping property names to their values.\n",
      " |      \n",
      " |      This method *always* traverses the class hierarchy and includes\n",
      " |      properties defined on any parent classes.\n",
      " |      \n",
      " |      Non-serializable properties are skipped and property values are in\n",
      " |      \"serialized\" format which may be slightly different from the values\n",
      " |      you would normally read from the properties; the intent of this method\n",
      " |      is to return the information needed to losslessly reconstitute the\n",
      " |      object instance.\n",
      " |      \n",
      " |      Args:\n",
      " |          include_defaults (bool, optional) :\n",
      " |              Whether to include properties that haven't been explicitly set\n",
      " |              since the object was created. (default: True)\n",
      " |      \n",
      " |      Returns:\n",
      " |         dict : mapping from property names to their values\n",
      " |  \n",
      " |  query_properties_with_values(self, query, include_defaults=True)\n",
      " |      Query the properties values of |HasProps| instances with a\n",
      " |      predicate.\n",
      " |      \n",
      " |      Args:\n",
      " |          query (callable) :\n",
      " |              A callable that accepts property descriptors and returns True\n",
      " |              or False\n",
      " |      \n",
      " |          include_defaults (bool, optional) :\n",
      " |              Whether to include properties that have not been explicitly\n",
      " |              set by a user (default: True)\n",
      " |      \n",
      " |      Returns:\n",
      " |          dict : mapping of property names and values for matching properties\n",
      " |  \n",
      " |  set_from_json(self, name, json, models=None, setter=None)\n",
      " |      Set a property value on this object from JSON.\n",
      " |      \n",
      " |      Args:\n",
      " |          name: (str) : name of the attribute to set\n",
      " |      \n",
      " |          json: (JSON-value) : value to set to the attribute to\n",
      " |      \n",
      " |          models (dict or None, optional) :\n",
      " |              Mapping of model ids to models (default: None)\n",
      " |      \n",
      " |              This is needed in cases where the attributes to update also\n",
      " |              have values that have references.\n",
      " |      \n",
      " |          setter(ClientSession or ServerSession or None, optional) :\n",
      " |              This is used to prevent \"boomerang\" updates to Bokeh apps.\n",
      " |      \n",
      " |              In the context of a Bokeh server application, incoming updates\n",
      " |              to properties will be annotated with the session that is\n",
      " |              doing the updating. This value is propagated through any\n",
      " |              subsequent change notifications that the update triggers.\n",
      " |              The session can compare the event setter to itself, and\n",
      " |              suppress any updates that originate from itself.\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |  \n",
      " |  themed_values(self)\n",
      " |      Get any theme-provided overrides.\n",
      " |      \n",
      " |      Results are returned as a dict from property name to value, or\n",
      " |      ``None`` if no theme overrides any values for this instance.\n",
      " |      \n",
      " |      Returns:\n",
      " |          dict or None\n",
      " |  \n",
      " |  unapply_theme(self)\n",
      " |      Remove any themed values and restore defaults.\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |  \n",
      " |  update(self, **kwargs)\n",
      " |      Updates the object's properties from the given keyword arguments.\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |      \n",
      " |      Examples:\n",
      " |      \n",
      " |          The following are equivalent:\n",
      " |      \n",
      " |          .. code-block:: python\n",
      " |      \n",
      " |              from bokeh.models import Range1d\n",
      " |      \n",
      " |              r = Range1d\n",
      " |      \n",
      " |              # set properties individually:\n",
      " |              r.start = 10\n",
      " |              r.end = 20\n",
      " |      \n",
      " |              # update properties together:\n",
      " |              r.update(start=10, end=20)\n",
      " |  \n",
      " |  update_from_json(self, json_attributes, models=None, setter=None)\n",
      " |      Updates the object's properties from a JSON attributes dictionary.\n",
      " |      \n",
      " |      Args:\n",
      " |          json_attributes: (JSON-dict) : attributes and values to update\n",
      " |      \n",
      " |          models (dict or None, optional) :\n",
      " |              Mapping of model ids to models (default: None)\n",
      " |      \n",
      " |              This is needed in cases where the attributes to update also\n",
      " |              have values that have references.\n",
      " |      \n",
      " |          setter(ClientSession or ServerSession or None, optional) :\n",
      " |              This is used to prevent \"boomerang\" updates to Bokeh apps.\n",
      " |      \n",
      " |              In the context of a Bokeh server application, incoming updates\n",
      " |              to properties will be annotated with the session that is\n",
      " |              doing the updating. This value is propagated through any\n",
      " |              subsequent change notifications that the update triggers.\n",
      " |              The session can compare the event setter to itself, and\n",
      " |              suppress any updates that originate from itself.\n",
      " |      \n",
      " |      Returns:\n",
      " |          None\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from bokeh.core.has_props.HasProps:\n",
      " |  \n",
      " |  dataspecs() from bokeh.core.has_props.MetaHasProps\n",
      " |      Collect the names of all ``DataSpec`` properties on this class.\n",
      " |      \n",
      " |      This method *always* traverses the class hierarchy and includes\n",
      " |      properties defined on any parent classes.\n",
      " |      \n",
      " |      Returns:\n",
      " |          set[str] : names of ``DataSpec`` properties\n",
      " |  \n",
      " |  dataspecs_with_props() from bokeh.core.has_props.MetaHasProps\n",
      " |      Collect a dict mapping the names of all ``DataSpec`` properties\n",
      " |      on this class to the associated properties.\n",
      " |      \n",
      " |      This method *always* traverses the class hierarchy and includes\n",
      " |      properties defined on any parent classes.\n",
      " |      \n",
      " |      Returns:\n",
      " |          dict[str, DataSpec] : mapping of names and ``DataSpec`` properties\n",
      " |  \n",
      " |  lookup(name) from bokeh.core.has_props.MetaHasProps\n",
      " |      Find the ``PropertyDescriptor`` for a Bokeh property on a class,\n",
      " |      given the property name.\n",
      " |      \n",
      " |      Args:\n",
      " |          name (str) : name of the property to search for\n",
      " |      \n",
      " |      Returns:\n",
      " |          PropertyDescriptor : descriptor for property named ``name``\n",
      " |  \n",
      " |  properties(with_bases=True) from bokeh.core.has_props.MetaHasProps\n",
      " |      Collect the names of properties on this class.\n",
      " |      \n",
      " |      This method *optionally* traverses the class hierarchy and includes\n",
      " |      properties defined on any parent classes.\n",
      " |      \n",
      " |      Args:\n",
      " |          with_bases (bool, optional) :\n",
      " |              Whether to include properties defined on parent classes in\n",
      " |              the results. (default: True)\n",
      " |      \n",
      " |      Returns:\n",
      " |         set[str] : property names\n",
      " |  \n",
      " |  properties_containers() from bokeh.core.has_props.MetaHasProps\n",
      " |      Collect the names of all container properties on this class.\n",
      " |      \n",
      " |      This method *always* traverses the class hierarchy and includes\n",
      " |      properties defined on any parent classes.\n",
      " |      \n",
      " |      Returns:\n",
      " |          set[str] : names of container properties\n",
      " |  \n",
      " |  properties_with_refs() from bokeh.core.has_props.MetaHasProps\n",
      " |      Collect the names of all properties on this class that also have\n",
      " |      references.\n",
      " |      \n",
      " |      This method *always* traverses the class hierarchy and includes\n",
      " |      properties defined on any parent classes.\n",
      " |      \n",
      " |      Returns:\n",
      " |          set[str] : names of properties that have references\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from bokeh.core.has_props.HasProps:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from bokeh.util.callback_manager.PropertyCallbackManager:\n",
      " |  \n",
      " |  remove_on_change(self, attr, *callbacks)\n",
      " |      Remove a callback from this object\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from bokeh.util.callback_manager.EventCallbackManager:\n",
      " |  \n",
      " |  on_event(self, event, *callbacks)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(p.circle())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"12c32fdc-594c-49db-ac03-a7f0c82586d4\" data-root-id=\"1479\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"288abd11-b987-4f1f-9bcf-ecba681a035e\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1490\"}],\"center\":[{\"id\":\"1493\"},{\"id\":\"1497\"}],\"left\":[{\"id\":\"1494\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"1515\"}],\"title\":{\"id\":\"1480\"},\"toolbar\":{\"id\":\"1505\"},\"x_range\":{\"id\":\"1482\"},\"x_scale\":{\"id\":\"1486\"},\"y_range\":{\"id\":\"1484\"},\"y_scale\":{\"id\":\"1488\"}},\"id\":\"1479\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1501\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1556\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1488\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1491\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"1490\"},\"ticker\":null},\"id\":\"1493\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]},\"selected\":{\"id\":\"1556\"},\"selection_policy\":{\"id\":\"1557\"}},\"id\":\"1512\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1482\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1498\",\"type\":\"PanTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#911005\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#911005\"},\"size\":{\"units\":\"screen\",\"value\":20},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1514\",\"type\":\"Scatter\"},{\"attributes\":{\"text\":\"\\u6563\\u70b9\\u56fe\\u793a\\u4f8b\"},\"id\":\"1480\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1499\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1552\"},\"ticker\":{\"id\":\"1491\"}},\"id\":\"1490\",\"type\":\"LinearAxis\"},{\"attributes\":{\"formatter\":{\"id\":\"1554\"},\"ticker\":{\"id\":\"1495\"}},\"id\":\"1494\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1495\",\"type\":\"BasicTicker\"},{\"attributes\":{\"overlay\":{\"id\":\"1504\"}},\"id\":\"1500\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1484\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1503\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1552\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1557\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1502\",\"type\":\"ResetTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1498\"},{\"id\":\"1499\"},{\"id\":\"1500\"},{\"id\":\"1501\"},{\"id\":\"1502\"},{\"id\":\"1503\"}]},\"id\":\"1505\",\"type\":\"Toolbar\"},{\"attributes\":{\"source\":{\"id\":\"1512\"}},\"id\":\"1516\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1486\",\"type\":\"LinearScale\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1504\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"axis\":{\"id\":\"1494\"},\"dimension\":1,\"ticker\":null},\"id\":\"1497\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"1512\"},\"glyph\":{\"id\":\"1513\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1514\"},\"selection_glyph\":null,\"view\":{\"id\":\"1516\"}},\"id\":\"1515\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1554\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"#911005\"},\"line_alpha\":{\"value\":0.5},\"line_color\":{\"value\":\"#911005\"},\"size\":{\"units\":\"screen\",\"value\":20},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1513\",\"type\":\"Scatter\"}],\"root_ids\":[\"1479\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"288abd11-b987-4f1f-9bcf-ecba681a035e\",\"root_ids\":[\"1479\"],\"roots\":{\"1479\":\"12c32fdc-594c-49db-ac03-a7f0c82586d4\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1479"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = [1,2,3,4,5]\n",
    "y = [6,7,2,4,5]\n",
    "\n",
    "p=figure(title=\"散点图示例\",plot_width=400,plot_height=400)\n",
    "\n",
    "p.scatter(x,y,\n",
    "        size=20,\n",
    "        marker=\"circle\",color=\"#911005\",alpha=0.5)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 气泡图（bubble）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"2da04e92-4a02-48e4-88bd-6c193a3d9447\" data-root-id=\"1607\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"d1eae0cb-2f6e-4c19-8d62-3da14286d5c8\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1618\"}],\"center\":[{\"id\":\"1621\"},{\"id\":\"1625\"}],\"left\":[{\"id\":\"1622\"}],\"renderers\":[{\"id\":\"1643\"}],\"title\":{\"id\":\"1608\"},\"toolbar\":{\"id\":\"1633\"},\"x_range\":{\"id\":\"1610\"},\"x_scale\":{\"id\":\"1614\"},\"y_range\":{\"id\":\"1612\"},\"y_scale\":{\"id\":\"1616\"}},\"id\":\"1607\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1610\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1627\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1614\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"1690\"},\"ticker\":{\"id\":\"1623\"}},\"id\":\"1622\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1616\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"1640\"}},\"id\":\"1644\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1630\",\"type\":\"ResetTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1632\"}},\"id\":\"1628\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"text\":\"bubble chart\"},\"id\":\"1608\",\"type\":\"Title\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"1626\"},{\"id\":\"1627\"},{\"id\":\"1628\"},{\"id\":\"1629\"},{\"id\":\"1630\"},{\"id\":\"1631\"}]},\"id\":\"1633\",\"type\":\"Toolbar\"},{\"attributes\":{\"axis\":{\"id\":\"1622\"},\"dimension\":1,\"ticker\":null},\"id\":\"1625\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1629\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1688\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1631\",\"type\":\"HelpTool\"},{\"attributes\":{\"formatter\":{\"id\":\"1688\"},\"ticker\":{\"id\":\"1619\"}},\"id\":\"1618\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1690\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1692\",\"type\":\"Selection\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"navy\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"navy\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1642\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1623\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1693\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"axis\":{\"id\":\"1618\"},\"ticker\":null},\"id\":\"1621\",\"type\":\"Grid\"},{\"attributes\":{\"data_source\":{\"id\":\"1640\"},\"glyph\":{\"id\":\"1641\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"1642\"},\"selection_glyph\":null,\"view\":{\"id\":\"1644\"}},\"id\":\"1643\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1626\",\"type\":\"PanTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"1632\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data\":{\"size\":{\"__ndarray__\":\"KAAAAFAAAAB4AAAAoAAAAA==\",\"dtype\":\"int32\",\"order\":\"little\",\"shape\":[4]},\"x\":[1,2,3,4],\"y\":[2,4,6,8]},\"selected\":{\"id\":\"1692\"},\"selection_policy\":{\"id\":\"1693\"}},\"id\":\"1640\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_color\":{\"value\":\"navy\"},\"line_color\":{\"value\":\"navy\"},\"size\":{\"field\":\"size\",\"units\":\"screen\"},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1641\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1619\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1612\",\"type\":\"DataRange1d\"}],\"root_ids\":[\"1607\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"d1eae0cb-2f6e-4c19-8d62-3da14286d5c8\",\"root_ids\":[\"1607\"],\"roots\":{\"1607\":\"2da04e92-4a02-48e4-88bd-6c193a3d9447\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1607"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 数据\n",
    "x=[1,2,3,4]\n",
    "y=[2,4,6,8]\n",
    "\n",
    "# 设置气泡大小\n",
    "sizes = np.array(y)*20\n",
    "p = figure(title=\"bubble chart\")\n",
    "p.scatter(x, y, marker=\"circle\", size=sizes, color=\"navy\",\n",
    "#     fill_color=None, line_width=2\n",
    "         )\n",
    "\n",
    "# 展示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 折线图\n",
    "\n",
    "* 折线图(Line)是将排列在工作表的列或行中的数据进行绘制后形成的线状图形。\n",
    "* 折线图可以显示随时间(根据常用比例设置)而变化的连续数据，非常适用于显示在相等时间间隔下数据的趋势。\n",
    "* 折线图中，数据是递增还是递减、增减的速率、增减的规律(周期性、螺旋性等)、峰值等特征都可以清晰地反映出来。\n",
    "* 折线图常用来分析数据随**时间**的变化趋势，也可用来分析多组数据随时间变化的相互作用和相互影响。例如，可用来分析某类商品或是某几类相关的商品随时间变化的销售情况，从而进一步预测未来的销售情况。\n",
    "> 1. x轴:用来表示时间的推移，并且间隔相同\n",
    "> 2. y轴:代表不同时刻的数据的大小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"4124e08d-ba00-4c57-9f93-62b725e1bb16\" data-root-id=\"2407\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"eab2f7c5-6688-4282-a500-6cbb0e1d1af9\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2418\"}],\"center\":[{\"id\":\"2421\"},{\"id\":\"2425\"},{\"id\":\"2453\"}],\"left\":[{\"id\":\"2422\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"2443\"}],\"title\":{\"id\":\"2408\"},\"toolbar\":{\"id\":\"2433\"},\"x_range\":{\"id\":\"2410\"},\"x_scale\":{\"id\":\"2414\"},\"y_range\":{\"id\":\"2412\"},\"y_scale\":{\"id\":\"2416\"}},\"id\":\"2407\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"axis\":{\"id\":\"2422\"},\"dimension\":1,\"ticker\":null},\"id\":\"2425\",\"type\":\"Grid\"},{\"attributes\":{\"axis\":{\"id\":\"2418\"},\"ticker\":null},\"id\":\"2421\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2450\",\"type\":\"Selection\"},{\"attributes\":{\"text\":\"line example\"},\"id\":\"2408\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"2451\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5,6],\"y\":[1,8,5,6,9,7]},\"selected\":{\"id\":\"2450\"},\"selection_policy\":{\"id\":\"2451\"}},\"id\":\"2440\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2431\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"2410\",\"type\":\"DataRange1d\"},{\"attributes\":{\"items\":[{\"id\":\"2454\"}]},\"id\":\"2453\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"2419\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"2429\",\"type\":\"SaveTool\"},{\"attributes\":{\"axis_label\":\"y\",\"formatter\":{\"id\":\"2448\"},\"ticker\":{\"id\":\"2423\"}},\"id\":\"2422\",\"type\":\"LinearAxis\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2426\"},{\"id\":\"2427\"},{\"id\":\"2428\"},{\"id\":\"2429\"},{\"id\":\"2430\"},{\"id\":\"2431\"}]},\"id\":\"2433\",\"type\":\"Toolbar\"},{\"attributes\":{\"axis_label\":\"x\",\"formatter\":{\"id\":\"2446\"},\"ticker\":{\"id\":\"2419\"}},\"id\":\"2418\",\"type\":\"LinearAxis\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":5,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2441\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"2426\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2446\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"2423\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"2430\",\"type\":\"ResetTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2432\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"2448\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"2416\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2412\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2414\",\"type\":\"LinearScale\"},{\"attributes\":{\"source\":{\"id\":\"2440\"}},\"id\":\"2444\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"Temp.\"},\"renderers\":[{\"id\":\"2443\"}]},\"id\":\"2454\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":5,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2442\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"2427\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"2440\"},\"glyph\":{\"id\":\"2441\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2442\"},\"selection_glyph\":null,\"view\":{\"id\":\"2444\"}},\"id\":\"2443\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"overlay\":{\"id\":\"2432\"}},\"id\":\"2428\",\"type\":\"BoxZoomTool\"}],\"root_ids\":[\"2407\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"eab2f7c5-6688-4282-a500-6cbb0e1d1af9\",\"root_ids\":[\"2407\"],\"roots\":{\"2407\":\"4124e08d-ba00-4c57-9f93-62b725e1bb16\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2407"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 数据\n",
    "x = [1,2,3,4,5,6]\n",
    "y = [1,8,5,6,9,7]\n",
    "\n",
    "# 画布：坐标轴标签，画布大小\n",
    "p = figure(title=\"line example\", x_axis_label='x', y_axis_label='y', width=400, height=400)\n",
    "\n",
    "# 画图：数据、图例、线宽\n",
    "p.line(x, y, legend=\"Temp.\", line_width=5)  # 折线\n",
    "\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"1d437f71-5020-4f64-a651-c3dd679b97b8\" data-root-id=\"2782\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"1dcabe6c-aed1-4c66-b9f0-ee049cfae4be\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2791\"}],\"center\":[{\"id\":\"2794\"},{\"id\":\"2798\"}],\"left\":[{\"id\":\"2795\"}],\"plot_height\":400,\"plot_width\":400,\"renderers\":[{\"id\":\"2816\"}],\"title\":{\"id\":\"2917\"},\"toolbar\":{\"id\":\"2806\"},\"x_range\":{\"id\":\"2783\"},\"x_scale\":{\"id\":\"2787\"},\"y_range\":{\"id\":\"2785\"},\"y_scale\":{\"id\":\"2789\"}},\"id\":\"2782\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2799\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2921\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"2796\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"2803\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"2787\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":{\"value\":0.1},\"line_color\":{\"field\":\"line_color\"},\"line_width\":{\"value\":4},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"2815\",\"type\":\"MultiLine\"},{\"attributes\":{\"overlay\":{\"id\":\"2805\"}},\"id\":\"2801\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"2804\",\"type\":\"HelpTool\"},{\"attributes\":{\"data_source\":{\"id\":\"2813\"},\"glyph\":{\"id\":\"2814\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"2815\"},\"selection_glyph\":null,\"view\":{\"id\":\"2817\"}},\"id\":\"2816\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"formatter\":{\"id\":\"2919\"},\"ticker\":{\"id\":\"2792\"}},\"id\":\"2791\",\"type\":\"LinearAxis\"},{\"attributes\":{\"text\":\"\"},\"id\":\"2917\",\"type\":\"Title\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2799\"},{\"id\":\"2800\"},{\"id\":\"2801\"},{\"id\":\"2802\"},{\"id\":\"2803\"},{\"id\":\"2804\"}]},\"id\":\"2806\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"2789\",\"type\":\"LinearScale\"},{\"attributes\":{\"formatter\":{\"id\":\"2921\"},\"ticker\":{\"id\":\"2796\"}},\"id\":\"2795\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2923\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"2791\"},\"ticker\":null},\"id\":\"2794\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2802\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2800\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"2792\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"2795\"},\"dimension\":1,\"ticker\":null},\"id\":\"2798\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2785\",\"type\":\"DataRange1d\"},{\"attributes\":{\"line_alpha\":{\"field\":\"line_alpha\"},\"line_color\":{\"field\":\"line_color\"},\"line_width\":{\"value\":4},\"xs\":{\"field\":\"xs\"},\"ys\":{\"field\":\"ys\"}},\"id\":\"2814\",\"type\":\"MultiLine\"},{\"attributes\":{},\"id\":\"2919\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"2805\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"2783\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2924\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"2813\"}},\"id\":\"2817\",\"type\":\"CDSView\"},{\"attributes\":{\"data\":{\"line_alpha\":[0.8,0.5],\"line_color\":[\"green\",\"yellow\"],\"xs\":[[1,3,2],[3,4,6,6]],\"ys\":[[2,1,4],[4,7,8,5]]},\"selected\":{\"id\":\"2923\"},\"selection_policy\":{\"id\":\"2924\"}},\"id\":\"2813\",\"type\":\"ColumnDataSource\"}],\"root_ids\":[\"2782\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"1dcabe6c-aed1-4c66-b9f0-ee049cfae4be\",\"root_ids\":[\"2782\"],\"roots\":{\"2782\":\"1d437f71-5020-4f64-a651-c3dd679b97b8\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2782"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "p = figure(plot_width=400, plot_height=400)\n",
    "# 线段x,y位置点为列表；两段线的颜色、透明度、线宽\n",
    "p.multi_line([[1, 3, 2], [3, 4, 6, 6]], [[2, 1, 4], [4, 7, 8, 5]],\n",
    "             color=[\"green\", \"yellow\"], alpha=[0.8, 0.5], line_width=4)\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n",
      "BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"6a6fea45-cdfe-4903-ad3e-ea649fa76cf9\" data-root-id=\"2980\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  var docs_json = {\"4fe1002b-66b4-497f-8a9f-6054f2596954\":{\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2991\"}],\"center\":[{\"id\":\"2994\"},{\"id\":\"2998\"},{\"id\":\"3022\"}],\"left\":[{\"id\":\"2995\"}],\"plot_height\":350,\"plot_width\":700,\"renderers\":[{\"id\":\"3012\"},{\"id\":\"3027\"},{\"id\":\"3042\"},{\"id\":\"3060\"},{\"id\":\"3080\"},{\"id\":\"3101\"}],\"title\":{\"id\":\"2981\"},\"toolbar\":{\"id\":\"3004\"},\"x_range\":{\"id\":\"2983\"},\"x_scale\":{\"id\":\"2987\"},\"y_range\":{\"id\":\"2985\"},\"y_scale\":{\"id\":\"2989\"}},\"id\":\"2980\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2985\",\"type\":\"DataRange1d\"},{\"attributes\":{\"data_source\":{\"id\":\"3009\"},\"glyph\":{\"id\":\"3010\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3011\"},\"selection_glyph\":null,\"view\":{\"id\":\"3013\"}},\"id\":\"3012\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"3019\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"3074\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"3118\",\"type\":\"Selection\"},{\"attributes\":{\"fill_color\":{\"value\":\"white\"},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":8},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3025\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"3119\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"3095\",\"type\":\"Selection\"},{\"attributes\":{\"data_source\":{\"id\":\"3077\"},\"glyph\":{\"id\":\"3078\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3079\"},\"selection_glyph\":null,\"view\":{\"id\":\"3081\"}},\"id\":\"3080\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"3003\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"data\":{\"x\":[2.0,3.5,4.0,6.0,7.0],\"y\":[4.0,12.25,16.0,36.0,49.0]},\"selected\":{\"id\":\"3053\"},\"selection_policy\":{\"id\":\"3054\"}},\"id\":\"3039\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"3024\"}},\"id\":\"3028\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_color\":{\"value\":\"red\"},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":6},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3078\",\"type\":\"Circle\"},{\"attributes\":{\"data\":{\"x\":[2.0,3.5,4.0,6.0,7.0],\"y\":[2.0,3.5,4.0,6.0,7.0]},\"selected\":{\"id\":\"3036\"},\"selection_policy\":{\"id\":\"3037\"}},\"id\":\"3024\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"orange\",\"line_dash\":[4,4],\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3100\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"3053\",\"type\":\"Selection\"},{\"attributes\":{\"num_minor_ticks\":10},\"id\":\"2996\",\"type\":\"LogTicker\"},{\"attributes\":{},\"id\":\"3020\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"white\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"units\":\"screen\",\"value\":8},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3026\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"3036\",\"type\":\"Selection\"},{\"attributes\":{\"axis\":{\"id\":\"2991\"},\"ticker\":null},\"id\":\"2994\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2987\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"3054\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"axis_label\":\"sections\",\"formatter\":{\"id\":\"3015\"},\"ticker\":{\"id\":\"2992\"}},\"id\":\"2991\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis_label\":\"particles\",\"formatter\":{\"id\":\"3017\"},\"ticker\":{\"id\":\"2996\"}},\"id\":\"2995\",\"type\":\"LogAxis\"},{\"attributes\":{},\"id\":\"2989\",\"type\":\"LogScale\"},{\"attributes\":{},\"id\":\"2999\",\"type\":\"PanTool\"},{\"attributes\":{\"data\":{\"x\":[2.0,3.5,4.0,6.0,7.0],\"y\":[10000.0,1778279410038.9229,1e+16,1e+36,1e+49]},\"selected\":{\"id\":\"3118\"},\"selection_policy\":{\"id\":\"3119\"}},\"id\":\"3098\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"3001\",\"type\":\"ResetTool\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3010\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[2.0,3.5,4.0,6.0,7.0],\"y\":[2.0,3.5,4.0,6.0,7.0]},\"selected\":{\"id\":\"3019\"},\"selection_policy\":{\"id\":\"3020\"}},\"id\":\"3009\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"3073\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"3002\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"3096\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data_source\":{\"id\":\"3098\"},\"glyph\":{\"id\":\"3099\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3100\"},\"selection_glyph\":null,\"view\":{\"id\":\"3102\"}},\"id\":\"3101\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"3057\"}},\"id\":\"3061\",\"type\":\"CDSView\"},{\"attributes\":{\"items\":[{\"id\":\"3023\"},{\"id\":\"3056\"},{\"id\":\"3076\"},{\"id\":\"3121\"}]},\"id\":\"3022\",\"type\":\"Legend\"},{\"attributes\":{\"text\":\"log axis example\"},\"id\":\"2981\",\"type\":\"Title\"},{\"attributes\":{\"data\":{\"x\":[2.0,3.5,4.0,6.0,7.0],\"y\":[100.0,3162.2776601683795,10000.0,1000000.0,10000000.0]},\"selected\":{\"id\":\"3073\"},\"selection_policy\":{\"id\":\"3074\"}},\"id\":\"3057\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"3098\"}},\"id\":\"3102\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"y=x\"},\"renderers\":[{\"id\":\"3012\"},{\"id\":\"3027\"}]},\"id\":\"3023\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis\":{\"id\":\"2995\"},\"dimension\":1,\"ticker\":null},\"id\":\"2998\",\"type\":\"Grid\"},{\"attributes\":{\"label\":{\"value\":\"y=10^x\"},\"renderers\":[{\"id\":\"3060\"},{\"id\":\"3080\"}]},\"id\":\"3076\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_color\":\"orange\",\"line_dash\":[4,4],\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3099\",\"type\":\"Line\"},{\"attributes\":{\"line_color\":\"red\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3058\",\"type\":\"Line\"},{\"attributes\":{\"data_source\":{\"id\":\"3039\"},\"glyph\":{\"id\":\"3040\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3041\"},\"selection_glyph\":null,\"view\":{\"id\":\"3043\"}},\"id\":\"3042\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"3077\"}},\"id\":\"3081\",\"type\":\"CDSView\"},{\"attributes\":{\"label\":{\"value\":\"y=x^2\"},\"renderers\":[{\"id\":\"3042\"}]},\"id\":\"3056\",\"type\":\"LegendItem\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_inspect\":\"auto\",\"active_multi\":null,\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"2999\"},{\"id\":\"3000\"},{\"id\":\"3001\"},{\"id\":\"3002\"}]},\"id\":\"3004\",\"type\":\"Toolbar\"},{\"attributes\":{\"data_source\":{\"id\":\"3057\"},\"glyph\":{\"id\":\"3058\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3059\"},\"selection_glyph\":null,\"view\":{\"id\":\"3061\"}},\"id\":\"3060\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"label\":{\"value\":\"y=10^x^2\"},\"renderers\":[{\"id\":\"3101\"}]},\"id\":\"3121\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3059\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[2.0,3.5,4.0,6.0,7.0],\"y\":[100.0,3162.2776601683795,10000.0,1000000.0,10000000.0]},\"selected\":{\"id\":\"3095\"},\"selection_policy\":{\"id\":\"3096\"}},\"id\":\"3077\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2983\",\"type\":\"DataRange1d\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3040\",\"type\":\"Line\"},{\"attributes\":{\"overlay\":{\"id\":\"3003\"}},\"id\":\"3000\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3041\",\"type\":\"Line\"},{\"attributes\":{\"ticker\":null},\"id\":\"3017\",\"type\":\"LogTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"red\"},\"size\":{\"units\":\"screen\",\"value\":6},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3079\",\"type\":\"Circle\"},{\"attributes\":{\"source\":{\"id\":\"3039\"}},\"id\":\"3043\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"3037\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2992\",\"type\":\"BasicTicker\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"3011\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"3015\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"3009\"}},\"id\":\"3013\",\"type\":\"CDSView\"},{\"attributes\":{\"data_source\":{\"id\":\"3024\"},\"glyph\":{\"id\":\"3025\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"3026\"},\"selection_glyph\":null,\"view\":{\"id\":\"3028\"}},\"id\":\"3027\",\"type\":\"GlyphRenderer\"}],\"root_ids\":[\"2980\"]},\"title\":\"Bokeh Application\",\"version\":\"2.1.1\"}};\n",
       "  var render_items = [{\"docid\":\"4fe1002b-66b4-497f-8a9f-6054f2596954\",\"root_ids\":[\"2980\"],\"roots\":{\"2980\":\"6a6fea45-cdfe-4903-ad3e-ea649fa76cf9\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    var attempts = 0;\n",
       "    var timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2980"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 数据\n",
    "x = [2.0,3.5,4.0,6.0,7.0]\n",
    "y0 = [i**2 for i in x]\n",
    "y1 = [10**i for i in x]\n",
    "y2 = [10**(i**2) for i in x]\n",
    "\n",
    "# 创建画布\n",
    "p = figure(\n",
    "    tools=\"pan,box_zoom,reset,save\",\n",
    "    y_axis_type=\"log\", title=\"log axis example\",\n",
    "    x_axis_label='sections', y_axis_label='particles',\n",
    "    width=700, height=350)  # y轴类型：log指数或linear线性\n",
    "# 增加图层，绘图\n",
    "p.line(x, x, legend=\"y=x\")\n",
    "p.circle(x, x, legend=\"y=x\", fill_color=\"white\", size=8)\n",
    "p.line(x, y0, legend=\"y=x^2\", line_width=3)\n",
    "p.line(x, y1, legend=\"y=10^x\", line_color=\"red\")\n",
    "p.circle(x, y1, legend=\"y=10^x\", fill_color=\"red\", line_color=\"red\", size=6)\n",
    "p.line(x, y2, legend=\"y=10^x^2\", line_color=\"orange\", line_dash=\"4 4\")\n",
    "# 显示\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 总结\n",
    "* figure可以选择绘制形状\n",
    "* show()展示图形\n",
    "* gridplot 展示组合图"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "383.188px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
